class Solution(object):
    def getMaximumXor(self, nums, maximumBit):
        n = len(nums)
        pre = [0] * n
        pre[0] = nums[0]
        for i in range(1, n):
            pre[i] = pre[i - 1] ^ nums[i]
        ans = [0] * n
        base = 0
        for i in range(maximumBit):
            base |= (1 << i)
        for i in range(n):
            t = pre[n - 1 - i]
            val = t & base
            ans[i] = (1 << maximumBit) - 1 - val
        return ans
